// 1.1 引入路由
import * as VueRouter from 'vue-router'
import Home from '../layout/Home.vue'
import Index from '../views/Index/index.vue'

// 1.2 引入组件
const routes = [
    {
        path: '/',
        name: 'home',
        component: Home,
        redirect: '/index',
        children: [
            // 首页
            {
                path: '/index',
                name: 'index',
                component: Index
            },

            // App服务
            {
                path: '/product',
                name: 'product',
                component: () => import(/* App服务 */ '@/views/Product/index.vue')
            }
        ]
    }
]

// 2.1 床架路由规则
const router = VueRouter.createRouter({
    history: VueRouter.createWebHashHistory(),
    routes
})

export default router